﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DocumentManagement/DocumentManagement.master" AutoEventWireup="true" CodeBehind="FileList.aspx.cs" Inherits="HRdex_Final.DocumentManagement.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <div align="center">
    <table style="width:100%;">
    <tr>
        <td>
            <asp:TextBox ID="txtnfName" runat="server"></asp:TextBox>
            <asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click" 
                Text="Search" />
            <asp:GridView ID="gvFiles" runat="server" AllowPaging="True" 
                AutoGenerateColumns="False" CellPadding="3" DataKeyNames="FileID" 
                DataSourceID="dsFiles" 
                onrowdeleted="gvFiles_RowDeleted" 
                onselectedindexchanged="gvFiles_SelectedIndexChanged" Width="700px" 
                BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px">
                <Columns>
                    <asp:BoundField DataField="FileID" HeaderText="FileID" InsertVisible="False" 
                        ReadOnly="True" SortExpression="FileID" Visible="False" />
                    <asp:BoundField DataField="FileName" HeaderText="FileName" 
                        SortExpression="FileName" >
                    <ItemStyle Height="20px" Width="300px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="FileType" HeaderText="FileType" 
                        SortExpression="FileType" Visible="False" />
                    <asp:BoundField DataField="FolderName" HeaderText="FolderName" 
                        SortExpression="FolderName" >
                    <ItemStyle Width="160px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="fulname" HeaderText="fulname" ReadOnly="True" 
                        SortExpression="fulname" />
                    <asp:ButtonField ButtonType="Button" CommandName="Select" HeaderText="Download" 
                        ShowHeader="True" Text="Download" />
                    <asp:ButtonField ButtonType="Button" CommandName="Delete" HeaderText="Delete" 
                        ShowHeader="True" Text="Delete" Visible="False" />
                </Columns>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#F1F1F1" />
                <SortedAscendingHeaderStyle BackColor="#007DBB" />
                <SortedDescendingCellStyle BackColor="#CAC9C9" />
                <SortedDescendingHeaderStyle BackColor="#00547E" />
            </asp:GridView>
            <asp:GridView ID="gvDelete" runat="server" AllowPaging="True" 
                AutoGenerateColumns="False" CellPadding="4" DataKeyNames="FileID" 
                DataSourceID="dsFiles" ForeColor="#333333" GridLines="None" 
                onrowdeleted="gvFiles_RowDeleted" 
                onselectedindexchanged="gvDelete_SelectedIndexChanged" Visible="False">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="FileID" HeaderText="FileID" InsertVisible="False" 
                        ReadOnly="True" SortExpression="FileID" Visible="False" />
                    <asp:BoundField DataField="FileName" HeaderText="FileName" 
                        SortExpression="FileName" />
                    <asp:BoundField DataField="FileType" HeaderText="FileType" 
                        SortExpression="FileType" />
                    <asp:BoundField DataField="FolderName" HeaderText="FolderName" 
                        SortExpression="FolderName" />
                    <asp:BoundField DataField="fulname" HeaderText="fulname" ReadOnly="True" 
                        SortExpression="fulname" />
                    <asp:ButtonField ButtonType="Button" CommandName="Select" HeaderText="Delete" 
                        ShowHeader="True" Text="Delete" />
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
            </asp:GridView>
            <asp:SqlDataSource ID="dsFiles" runat="server" 
                ConnectionString="<%$ ConnectionStrings:HRmainConnectionString %>" 
                
                
                
                SelectCommand="SELECT formFile.FileID, formFile.FileName, formFile.FileType, formFolder.FolderName, formEmployees.LastName + ', ' + formEmployees.FirstName AS fulname FROM formFile INNER JOIN formFolder ON formFile.FolderID = formFolder.FolderID INNER JOIN formEmployees ON formFile.EmployeesID = formEmployees.EmployeeID WHERE (formFile.FolderID = @parentFolder)">
                <SelectParameters>
                    <asp:SessionParameter Name="parentFolder" SessionField="pFolder" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:Button ID="btnDelete" runat="server" onclick="btnDelete_Click" 
                Text="Delete Files" />
        </td>
    </tr>
    <tr>
        <td>
            <asp:FileUpload ID="upldrFiles" runat="server" />
            <asp:Button ID="btnUpload" runat="server" onclick="btnUpload_Click" 
                style="height: 26px" Text="Upload" />
            <br />
            <asp:Label ID="lblStatus" runat="server"></asp:Label>
            <br />
        </td>
    </tr>
</table>

</div>
</asp:Content>
